package com.codingman.jpademo3;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

public class Demo1 {
	public static void main(String[] args) {
		EntityManagerFactory emf = Persistence.createEntityManagerFactory("employee_unit");
		EntityManager em = emf.createEntityManager();

		em.getTransaction().begin();
		
		Employee1 d1 = new Employee1(101, "Ann", 100.00);						
		d1.setAddress(new Address(1, "Shenzhen", "China"));
				
		em.persist(d1);

		em.getTransaction().commit();

		em.close();
		emf.close();
	}
}
